Ext.namespace('mdmp.gwbChanges.add');

mdmp.gwbChanges.add.win = Ext.extend(Ext.Window, {

	layout:'border',
	initComponent : function() {

		this.title="参数配置",
		this.frame=true;
        this.border=true;
        this.width=550;
        this.height=600;
        this.buttonAlign='center';
        this.modal=true;
        var form = this.xForm();
		this.items = form;
        this.buttons=[{id:'before',text:"上一步"},{id:'next',text:"下一步"},{hidden:true,id:'save',text:"保存"},{text:"取消",handler:function(){
        	 Ext.getCmp('aa').close();
        }}];

		
		
		
		
		
		mdmp.gwbChanges.add.win.superclass.initComponent.call(this);
	},
	beforeDestroy : function() {
		mdmp.gwbChanges.add.win.superclass.beforeDestroy.apply(this, arguments);

	},
	xForm : function() {
		
		
		
		
		var orgComb1=new Ext.form.ComboBox({
		    id:'sex1',
		    name:'sex1',
		    fieldLabel:'数据类型',
		    mode : 'local',
	        triggerAction : 'all',
	        editable :false, 
	        displayField : 'TEXT',
	        valueField : 'ID',
	        width:300,
	        store: new Ext.data.ArrayStore({
				fields:[
				        'ID',
				        'TEXT'
				],
				data:[["0","字符串"]]
			})/*,
			listeners :{
				expand :function(){
		        	Ext.getCmp('sex1').reset() ; 
		        }
			}*/
	});

		
		
		var orgComb2=new Ext.form.ComboBox({
		    id:'sex2',
		    name:'sex2',
		    fieldLabel:'控件类型',
		    mode : 'local',
	        triggerAction : 'all',
	        editable :false, 
	        displayField : 'TEXT',
	        valueField : 'ID',
	        width:300,
	        store: new Ext.data.ArrayStore({
				fields:[
				        'ID',
				        'TEXT'
				],
				data:[["0","下拉框"],["1","频度日期控件"]]
			}),
			listeners:{
				'select':function(combo,record,index){
				//	alert(combo.getRawValue());
					if(combo.getRawValue()=="频度日期控件"){
						Ext.getCmp('next').hide();
						Ext.getCmp('save').show();
						Ext.getCmp('time1').show();
						Ext.getCmp('time2').show();
						Ext.getCmp('time3').show();
						Ext.getCmp('time4').show();
						Ext.getCmp('time5').show();
						Ext.getCmp('time6').show();
						Ext.getCmp('time7').show();
					}else{
						
						Ext.getCmp('save').hide();
						Ext.getCmp('next').show();
						Ext.getCmp('time1').hide();
						Ext.getCmp('time2').hide();
						Ext.getCmp('time3').hide();
						Ext.getCmp('time4').hide();
						Ext.getCmp('time5').hide();
						Ext.getCmp('time6').hide();
						Ext.getCmp('time7').hide();
					}
				}
				
			}
	});
	
		
		
		
		
		  var   addset = new Ext.form.FieldSet({
	    	   height:350,
	           border:true,
	           frame:true,
	           labelWidth:100,
	           autoHeight:true,
	           items:[{layout:'form',style:'margin-top:15px',items:[
        				    {
        					    width:'300px',
        						xtype : 'textfield',
        						fieldLabel : "参数名称"
        						}]},
        						{layout:'form',items:[
        					    {
        					    width:'300px',
        						xtype : 'textarea',
        						fieldLabel : "描述"
        						}]},
        						{layout:'form',items:[
        	                      orgComb1]},
        						{layout:'form',items:[
        	                      orgComb2]},
        	                /*      {layout:'form',items:{xtype:'radiogroup',fieldLabel:'频度类型',columns:1,items:[
                       		   
                       		   
                       		   
                       		   {xtype:'radio',boxLabel : '年',inputValue:0,name:'addMethod',checked: true},
                       		   {xtype:'radio',boxLabel : '半年',inputValue:1,name:'addMethod'},
                       		 {xtype:'radio',boxLabel : '季',inputValue:2,name:'addMethod'},
                       		 {xtype:'radio',boxLabel : '月',inputValue:3,name:'addMethod'},
                       		 {xtype:'radio',boxLabel : '旬',inputValue:4,name:'addMethod'},
                       		 {xtype:'radio',boxLabel : '周',inputValue:5,name:'addMethod'},
                       		 {xtype:'radio',boxLabel : '日',inputValue:6,name:'addMethod'}
                       		   ]}}*/
	                                            	                      
	                                            	                      
	                                            						
	                                            	  					{hidden:true,id:'time1',layout:'column',items:[{columnWidth:.5,layout:'form',items:[{  boxLabel: "年",
	                                            					    xtype: "checkbox",
	                                            						fieldLabel : ""}]},{columnWidth:.5,layout:'form',items:[{xtype: 'box', //或者xtype: 'component',   
																			   width: 132,  
																			   id: 'imagebox',  
																			   name: 'imagebox',  
																			   height: 136,    
																			   autoEl: {  
																			   tag: 'img',    //指定为img标签       
																			   src: '/Demo3/images/gwbyear.png'    //指定url路径       
																			    }  }]}]},
                                            	  					{hidden:true,id:'time2',layout:'column',items:[{columnWidth:.5,layout:'form',items:[{  boxLabel: "半年",
	                                            					    xtype: "checkbox",
	                                            						fieldLabel : ""}]},{columnWidth:.5,layout:'form',items:[{xtype: 'box', //或者xtype: 'component',   
																	   width: 132,  
																	   id: 'imagebox',  
																	   name: 'imagebox',  
																	   height: 136,    
																	   autoEl: {  
																	   tag: 'img',    //指定为img标签       
																	   src: '/Demo3/images/halfyear.png'    //指定url路径       
																	    }  }]}]},
                                            	  					{hidden:true,id:'time3',layout:'column',items:[{columnWidth:.5,layout:'form',items:[{  boxLabel: "季",
	                                            					    xtype: "checkbox",
	                                            						fieldLabel : ""}]},{columnWidth:.5,layout:'form',items:[{xtype: 'box', //或者xtype: 'component',   
																			   width: 132,  
																			   id: 'imagebox',  
																			   name: 'imagebox',  
																			   height: 136,    
																			   autoEl: {  
																			   tag: 'img',    //指定为img标签       
																			   src: '/Demo3/images/jidu.png'    //指定url路径       
																			    }  }]}]}
																	    ,
                                            	  					{hidden:true,id:'time4',layout:'column',items:[{columnWidth:.5,layout:'form',items:[{  boxLabel: "月",
	                                            					    xtype: "checkbox",
	                                            						fieldLabel : "频度类型"}]},{columnWidth:.5,layout:'form',items:[{xtype: 'box', //或者xtype: 'component',   
																			   width: 132,  
																			   id: 'imagebox',  
																			   name: 'imagebox',  
																			   height: 136,    
																			   autoEl: {  
																			   tag: 'img',    //指定为img标签       
																			   src: '/Demo3/images/month.png'    //指定url路径       
																			    }  }]}]},
			                                            	  					{hidden:true,id:'time5',layout:'column',items:[{columnWidth:.5,layout:'form',items:[{  boxLabel: "旬",
				                                            					    xtype: "checkbox",
				                                            						fieldLabel : ""}]},{columnWidth:.5,layout:'form',items:[{xtype: 'box', //或者xtype: 'component',   
																						   width: 132,  
																						   id: 'imagebox',  
																						   name: 'imagebox',  
																						   height: 136,    
																						   autoEl: {  
																						   tag: 'img',    //指定为img标签       
																						   src: '/Demo3/images/xun.png'    //指定url路径       
																						    }  }]}]},
						                                            	  					{hidden:true,id:'time6',layout:'column',items:[{columnWidth:.5,layout:'form',items:[{  boxLabel: "周",
							                                            					    xtype: "checkbox",
							                                            						fieldLabel : ""}]},{columnWidth:.5,layout:'form',items:[{xtype: 'box', //或者xtype: 'component',   
																									   width: 132,  
																									   id: 'imagebox',  
																									   name: 'imagebox',  
																									   height: 136,    
																									   autoEl: {  
																									   tag: 'img',    //指定为img标签       
																									   src: '/Demo3/images/zhou.png'    //指定url路径       
																									    }  }]}]},
					                                            	  					{hidden:true,id:'time7',layout:'column',items:[{columnWidth:.5,layout:'form',items:[{  boxLabel: "日",
						                                            					    xtype: "checkbox",
						                                            						fieldLabel : ""}]},{columnWidth:.5,layout:'form',items:[{xtype: 'box', //或者xtype: 'component',   
																								   width: 132,  
																								   id: 'imagebox',  
																								   name: 'imagebox',  
																								   height: 136,    
																								   autoEl: {  
																								   tag: 'img',    //指定为img标签       
																								   src: '/Demo3/images/day.png'    //指定url路径       
																								    }  }]}]}  
                                        	  					
	                                            	  				]
		  
		    });
		  
	      return new  Ext.form.FormPanel({
	      	    region:'center',
		        height:150,
		        border:true,
		        labelWidth:40,
		        bodyStyle : 'overflow-x:visible; overflow-y:scroll',
		        labelAlign:'right',
		        frame:true,
		        items:[addset]
		    });	  
	      
	      
	   
		
	}
	
	
	

});




mdmp.gwbChanges.add.win2 = Ext.extend(Ext.Window, {

	layout:'border',
	initComponent : function() {

		this.title="参数配置",
		this.frame=true;
        this.border=true;
        this.width=700;
        this.height=400;
        this.buttonAlign='center';
        this.modal=true;
        var form = this.xForm();
		this.items = form;
        this.buttons=[{id:'before2',text:"上一步"},{id:'next2',text:"下一步"},{hidden:true,id:'save2',text:"保存"},{text:"取消",handler:function(){
        	 Ext.getCmp('aa').close(); 
        	Ext.getCmp('bb').close();
        }}];

		
		
		
		
		
		mdmp.gwbChanges.add.win2.superclass.initComponent.call(this);
	},
	beforeDestroy : function() {
		mdmp.gwbChanges.add.win2.superclass.beforeDestroy.apply(this, arguments);

	},
	xForm : function() {
		
		
		
		
		
		var orgComb3=new Ext.form.ComboBox({
		    fieldLabel:'备选值_实际值',
		    mode : 'local',
	        triggerAction : 'all',
	        editable :false, 
	        displayField : 'TEXT',
	        valueField : 'ID',
	        width:140,
	        store: new Ext.data.ArrayStore({
				fields:[
				        'ID',
				        'TEXT'
				],
				data:[["0","BRAND_ID"],["1","BRAND_NAME"]]
			})/*,
			listeners :{
				expand :function(){
		        	Ext.getCmp('sex1').reset() ; 
		        }
			}*/
	});

		var orgComb4=new Ext.form.ComboBox({
		    fieldLabel:'备选值_显示值',
		    mode : 'local',
	        triggerAction : 'all',
	        editable :false, 
	        displayField : 'TEXT',
	        valueField : 'ID',
	        width:140,
	        store: new Ext.data.ArrayStore({
				fields:[
				        'ID',
				        'TEXT'
				],
				data:[["0","BRAND_ID"],["1","BRAND_NAME"]]
			})/*,
			listeners :{
				expand :function(){
		        	Ext.getCmp('sex1').reset() ; 
		        }
			}*/
	});  	
		
		
		var orgComb5=new Ext.form.ComboBox({
		    fieldLabel:'默认值_实际值',
		    mode : 'local',
	        triggerAction : 'all',
	        editable :false, 
	        displayField : 'TEXT',
	        valueField : 'ID',
	        width:140,
	        store: new Ext.data.ArrayStore({
				fields:[
				        'ID',
				        'TEXT'
				],
				data:[["0","BRAND_ID"],["1","BRAND_NAME"]]
			})/*,
			listeners :{
				expand :function(){
		        	Ext.getCmp('sex1').reset() ; 
		        }
			}*/
	});  	
		
		var orgComb6=new Ext.form.ComboBox({
		    fieldLabel:'默认值_显示值',
		    mode : 'local',
	        triggerAction : 'all',
	        editable :false, 
	        displayField : 'TEXT',
	        valueField : 'ID',
	        width:140,
	        store: new Ext.data.ArrayStore({
				fields:[
				        'ID',
				        'TEXT'
				],
				data:[["0","BRAND_ID"],["1","BRAND_NAME"]]
			})/*,
			listeners :{
				expand :function(){
		        	Ext.getCmp('sex1').reset() ; 
		        }
			}*/
	});  	
		
		
		
		
		
		  var   addset = new Ext.form.FieldSet({
	    	   height:350,
	           border:true,
	           frame:true,
	           labelWidth:100,
	           autoHeight:true,
	           items:[{layout:'form',items:[
	                                           				 {    
	                                     			            xtype:'checkboxgroup',    
	                                     			            fieldLabel:'',    
	                                     			            columns:4,//3列    
	                                     			            items:[    
	                                     			                 {boxLabel:'允许多选',name:'swim'},    
	                                     			                 {boxLabel:'手工输入',name:'walk'}  
	                                     			                  
	                                     			            ]    
	                                     					}]
	                                     				    },
	                    {layout:'form',items:[{width:'400px',
						xtype : 'textarea',
						fieldLabel : "备选值设置"}]}   , 
						 {layout:'form',items:[{width:'400px',
								xtype : 'textarea',
								fieldLabel : "备选值设置"}]}  ,
				{layout:'column',items:[{columnWidth:.4,layout:'form',items:[orgComb3]},{columnWidth:.5,layout:'form',items:[orgComb4]}]},
				{layout:'column',items:[{columnWidth:.4,layout:'form',items:[orgComb5]},{columnWidth:.5,layout:'form',items:[orgComb6]}]}
						]
		  
		    });
		  
	      return new  Ext.form.FormPanel({
	      	    region:'center',
		        height:150,
		        border:true,
		        labelWidth:40,
		        labelAlign:'right',
		        frame:true,
		        items:[addset]
		    });	  
	      
	      
	   
		
	}
	
	
	

});




mdmp.gwbChanges.add.win3 = Ext.extend(Ext.Window, {

	layout:'border',
	initComponent : function() {

		this.title="报表配置",
		this.frame=true;
        this.border=true;
        this.width=750;
        this.height=600;
        this.buttonAlign='center';
        this.modal=true;
        var form = this.xForm();
        var panel=this.XPanel();
        var form2=this.XForm2();
		this.items = [form,panel,form2];
        this.buttons=[{text:"确定"},{text:"取消",handler:function(){
        	 Ext.getCmp('cc').close();
        }}];

		
		
		
		
		
		mdmp.gwbChanges.add.win3.superclass.initComponent.call(this);
	},
	beforeDestroy : function() {
		mdmp.gwbChanges.add.win3.superclass.beforeDestroy.apply(this, arguments);

	},
	xForm : function() {
		
		  var   addset = new Ext.form.FieldSet({
	    	   height:200,
	           border:true,
	           frame:true,
	           labelWidth:100,
	           autoHeight:true,
	           items:[{style:'margin-top:20px',layout:'form',items:[{width:'400px',
					xtype : 'textfield',
					fieldLabel : "名字"}]},
				/*	{layout:'form',items:[{width:'400px',
						xtype : 'textfield',
						fieldLabel : "别名"}]},*/
				/*	{layout:'column',items:[{columnWidth:.578,layout:'form',items:[{width:'600px',
					xtype : 'textfield',
					fieldLabel : "链接"}]},{columnWidth:.3,layout:'form',items:[{
					xtype : 'button',
					text : "选择内部资源"}]}]},*/
						{layout:'form',items:[{width:'400px',
							xtype : 'textfield',
							fieldLabel : "链接"}]},
					{layout:'form',items:[{width:'400px',
						xtype : 'textarea',
						fieldLabel : "描述"}]},
						{layout:'column',items:[{columnWidth:.15,layout:'form',items:[{
					fieldLabel : "自定义图标"}]},{columnWidth:.3,layout:'form',items:[{xtype : 'button',
					text : "上传文件",iconCls : 'silk_page_find'}]}]}]
		  
		    });
		  
	      return new  Ext.form.FormPanel({
	      	    region:'north',
		        height:200,
		        border:true,
		        labelWidth:40,
		        labelAlign:'right',
		        frame:true,
		        items:[addset]
		    });	  
	      
	      
	   
		
	},
	XPanel:function(){
		
		
		

		
		
		var cm = new Ext.grid.ColumnModel([ {
			header : '<center>参数名称</center>',
			dataIndex : 'NAME',
		algin : 'center',
			width:140,
			renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){
	            var returnStr = "<INPUT type='text' >";
	            return returnStr;
	          }
		},{
			header : '<center>参数值</center>',
			dataIndex : 'CODE1',
			algin : 'center',
			width:140,
			renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){
	            var returnStr = "<INPUT type='text' >";
	            return returnStr;
	          }
		}, {
			header : '<center>内部参数</center>',
			dataIndex : 'CODE2',
			algin : 'center',
			width:120
		}, {
			header : '<center>操作</center>',
			dataIndex : 'DO',
			algin : 'center',
			width:120,
			renderer:function(value,cellmeta){
		            var returnStr = "<input type='button' value='添加' onclick=\"cht()\"><input type='button' value='修改'>";
		            return returnStr;
		          }
		}

		]);
		
		var store = new Ext.data.Store({
			proxy : new Ext.data.HttpProxy({
				url : '${path}/StmatradeController/Allselect.do'
			}),
			autoLoad : false,
			reader : new Ext.data.JsonReader({
				root : 'items',
				totalProperty : 'totalCount',
				fields : [ 'NAME','CODE1', 'CODE2','DO']
			})
		});
		
		
		
		
		
		
		
	var	Grid = new Ext.grid.GridPanel({
			cm : cm,
			id:'OnlyGrid',
			region : 'center',
			store : store,
			autoScroll : true,
			loadMask : {
				msg : '正在查询，请稍候...'
			},
		       bbar : [{
		    	   id:'addpp',
					text : "增加",
					iconCls : 'silk_page_find'
				}]
		});
		
		
	
var	Form= new Ext.form.FormPanel({
		frame : true,
		border : true,
		labelAlign : 'right',
		region : 'west',
		layout : 'form',
		width:110,
		
		items:[{style:'margin-top:80px',layout:'form',items:[{fieldLabel : "自定义参数"}]}]

	

	});
	
	
	return new Ext.Panel({
		frame : true,
		border : true,
		region:'center',
		layout : 'border',
		height : 240,
		
		items : [ Grid, Form]
	

	});
	
	
		
	},
	
	XForm2:function(){
		
		return new Ext.form.FormPanel({
			frame : true,
			border : true,
			labelAlign : 'right',
			region : 'south',
			height:90,
			layout : 'form',
			
			items:[{layout:'form',style:'margin-bottom:30px',items:[
			 {    
		            xtype:'checkboxgroup',    
		            fieldLabel:'',    
		            columns:1,//3列    
		            items:[    
		                 {boxLabel:'在当前窗口打开',name:'swim',checked:true}  
		                
		                  
		            ]    
		        }]
			    }]


		});
	}
	
	

});


mdmp.gwbChanges.add.win4 = Ext.extend(Ext.Window, {

	layout:'border',
	initComponent : function() {

		this.title="自定义参数添加",
		this.frame=true;
        this.border=true;
        this.width=480;
        this.height=400;
        this.buttonAlign='center';
        this.modal=true;
        var grid=this.XGrid();
		this.items = grid;
        this.buttons=[{text:"确定"},{text:"取消",handler:function(){
        	
        	Ext.getCmp('qq').close();
        	
        	
        }}];

		
		
		
		
		
		mdmp.gwbChanges.add.win4.superclass.initComponent.call(this);
	},
	beforeDestroy : function() {
		mdmp.gwbChanges.add.win4.superclass.beforeDestroy.apply(this, arguments);

	},
	XGrid:function(){
		
		
		this.sm = sm;
		var sm = new Ext.grid.CheckboxSelectionModel({
			singleSelect : true
		});

		var cm = new Ext.grid.ColumnModel([sm, {
			header : '<center>参数名</center>',
			dataIndex : 'NAME',
		algin : 'center',
			width:160
		},{
			header : '<center>数据类型</center>',
			dataIndex : 'DATA',
			algin : 'center',
			width:160
		},{
			header : '<center>控件类型</center>',
			dataIndex : 'KONGJIAN',
			algin : 'center',
			width:160
		}

		]);
		

	     var data = [  ['开始日期','字符串','频度日期控件'],
	                   ['结束日期','字符串','频度日期控件'],
	                   ['卷烟规格','字符串','下拉框'],
	                   ['客户经理','字符串','下拉框']
	                  
	                  
	                  ];  
	          var rt = Ext.data.Record.create([
	                                            {name: 'NAME'},
	                                            {name: 'DATA'},
	                                            {name: 'KONGJIAN'}
	                                       ]);
	          var store=new Ext.data.Store({
	         	 proxy: new Ext.data.MemoryProxy(data),  
	     			
	     			reader : new Ext.data.ArrayReader({},rt)
	     			
	     		});
	          store.load();
		
	return new Ext.grid.GridPanel({
		cm : cm,
		sm:sm,
		region : 'center',
		store : store,
		autoScroll : true,
		loadMask : {
			msg : '正在查询，请稍候...'
		},listeners:{
		    render:function(){
		        var hd_checker = this.getEl().select('div.x-grid3-hd-checker');
		        if (hd_checker.hasClass('x-grid3-hd-checker')) {
		        hd_checker.removeClass('x-grid3-hd-checker');
		        }
		        }
		        }
		
	});
	
	
		
	}
	
	

});


